Fix gdk_window_get_geometry for native children with non-native parent
authorAlexander Larsson <alexl@redhat.com>
Sun, 16 Aug 2009 20:24:00 +0000 (22:24 +0200)
committerAlexander Larsson <alexl@redhat.com>
Sun, 16 Aug 2009 20:27:19 +0000 (22:27 +0200)
gdk_window_get_geometry calls the native function for all non-native
windows. This returns coords relative to the native parent. We need
to convert this to be relative to the client side parent.

This fixes DnD coordinates in firefox (bug 588437).

gdk/gdkwindow.c

index f42cc75ebd3b4d0cbfcba9b161b6d70779983ee2..a31d570dd64250b3d231340a2088975d115256f5 100644 (file)
@@ -7272,7 +7272,7 @@ gdk_window_get_geometry (GdkWindow *window,
                         gint      *height,
                         gint      *depth)
 {
-  GdkWindowObject *private;
+  GdkWindowObject *private, *parent;
 
   if (!window)
     {
@@ -7289,9 +7289,19 @@ gdk_window_get_geometry (GdkWindow *window,
   if (!GDK_WINDOW_DESTROYED (window))
     {
       if (gdk_window_has_impl (private))
-       GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_geometry (window, x, y,
-                                                                width, height,
-                                                                depth);
+       {
+         GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_geometry (window, x, y,
+                                                                  width, height,
+                                                                  depth);
+         /* This reports the position wrt to the native parent, we need to convert
+            it to be relative to the client side parent */
+         parent = private->parent;
+         if (!gdk_window_has_impl (parent))
+           {
+             *x -= parent->abs_x;
+             *y -= parent->abs_y;
+           }
+       }
       else
        {
          if (x)